﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Cloud.Model;
using Cloud.BLL;

public partial class Three_Managerment_Problem_two_Bj : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["users"] == null)
            {
                Response.Write("<script>alert('登录超时'); window.parent.location.href='/index.html'</script>");
            }
            if (IsPostBack)
            {

            }
            else
            {

                int id = Convert.ToInt32(Request.QueryString["id"]);
                Problem activity = ProblemManager.FindById(id);
                this.sjid.Value = activity.Appealid.ToString();
                this.times.Value = activity.Regtime.ToString();
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }

    protected void Send_Click(object sender, EventArgs e)
    {

        try
        {
            Problem_historic2 his = new Problem_historic2();
            his.Blyj = this.con.Value;

            his.Bm2 = "";

            his.Idopen = this.sjid.Value;


            his.Bm1 = ((USER_INFO)Session["users"]).DEPARTMENT;
            his.Item1 = 0;
            his.Item2 = "";
            his.Item3 = "";
            his.Name = ((USER_INFO)Session["users"]).USER_NAME;
            his.Times = DateTime.Now;
            his.Timese = new DateTime(1900, 01, 01, 00, 00, 00);
            //int qxs = (Convert.ToInt32(Session["QX"]));// 04一级部门  05二级   06 三级




            if (Session["users"] == null)
            {
                Response.Write("<script>alert('登录超时'); window.parent.location.href='/index.html'</script>");
            }

            int id = Convert.ToInt32(Request.QueryString["id"]);
            Problem activity = ProblemManager.FindById(id);

            if (Request.QueryString["type"].Equals("shenban"))
            {
                his.Title = ((USER_INFO)Session["users"]).USER_NAME + " 申请办结 ";
                activity.Handle_type = 2;
                activity.Bm1_type = 2;
                his.Evente = 9;
            }
            if (Request.QueryString["type"].Equals("zhiban"))
            {
                his.Title = ((USER_INFO)Session["users"]).USER_NAME + "    进行办理 ";
                activity.Handle_type = 2;
                activity.Bm1_type = 2;
                his.Evente = 2;
            }
            if (Request.QueryString["type"].Equals("boh"))//
            {
                his.Title = ((USER_INFO)Session["users"]).USER_NAME + "    驳回事件 ";
                activity.Handle_type = 0;
                activity.Bm2_type = 3;
                activity.Current_ld = 2;//2ji
                activity.Reject_num = activity.Reject_num + 1;

                his.Evente = 5;

                if (activity.Reject_num > 2)
                {
                    Response.Write("<script>alert('无法驳回，请办结！');</script>");
                    return;
                }

            }
            if (Request.QueryString["type"].Equals("zcbh"))  //2ji - 3ji
            {
                his.Title = ((USER_INFO)Session["users"]).USER_NAME + "    驳回事件 ";
                activity.Handle_type = 0;
                activity.Bm2_type = 3;
                activity.Current_ld = 2;//3ji
                his.Evente = 5;
                if (activity.Reject_num > 2)
                {
                    Response.Write("<script>alert('无法驳回，请办结！');</script>");
                    return;
                }
            }

            if (ProblemManager.Update(activity) > 0)
            {
                Problem_historic2Manager.Save(his);
                Response.Write("<script>alert('处理成功！');location.href='index.aspx'</script>");
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('登陆信息失效,请重新登陆!'); window.parent.location.href='/index.html'</script>");
            return;
        }
    }
}